/// @tags: Simulate
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <numeric>

using std::cin, std::cout, std::endl;

namespace BlueQuantum {

constexpr int maxc = 20 * 3 * 4;

char str[maxc];
bool server = 0;
int score[2] = {};
int game[2] = {};

void solve() {
  if (score[0] == 10) {
    game[0]++;
    score[0] = score[1] = 0;
    server = 0;
  } else if (score[1] == 10) {
    game[1]++;
    score[0] = score[1] = 0;
    server = 1;
  } else if (std::abs(score[0] - score[1]) >= 2 &&
             std::max(score[0], score[1]) >= 5) {
    if (score[0] > score[1]) {
      game[0]++;
      server = 0;
    } else {
      game[1]++;
      server = 1;
    }
    score[0] = score[1] = 0;
  }
}

void output() {
  if (game[0] == 2 || game[1] == 2) {
    if (game[0] == 2) {
      cout << "2 (winner) - " << game[1] << '\n';
    } else {
      cout << game[0] << " - 2 (winner)\n";
    }
  } else {
    cout << game[0] << " (" << score[0] << (server ? "" : "*") << ") - ";
    cout << game[1] << " (" << score[1] << (!server ? "" : "*") << ")\n";
  }
}

int main() {
  cin >> str;
  int n = strlen(str);
  for (int i = 0; i < n; ++i) {
    switch (str[i]) {
      case 'S':
        score[server]++;
        solve();
        break;

      case 'R':
        score[!server]++;
        server = !server;
        solve();
        break;

      case 'Q':
        output();
        break;
    }
  }
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("M. Fastminton.in", "r", stdin);
  freopen("M. Fastminton.out", "w", stdout);
#endif
#endif

  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
